package com.t11;

/**
 * Created by xuyiwei on 2018/7/22.
 */
import typeinfo.pets.*;
import java.util.*;

public class CollectionSequence
       extends AbstractCollection<Pet>{
    private Pet[] pets = Pets.createArray(8);
    @Override
    public Iterator<Pet> iterator() {
        return new Iterator<Pet>() {
            private  int  index = 0;
            @Override
            public boolean hasNext() {
                return index < pets.length;
            }
            @Override
            public Pet next() {
                return pets[index++];
            }
        };
    }

    @Override
    public int size() {
        return pets.length;
    }
}